<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/webpage/include/taglib.jsp" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<html>
<head>
    <title>扫码过机</title>
    <script type="text/javascript" src="${ctxStatic}/plugin/layui2.0/jquery-1.10.2.min.js"></script>
    <script type="text/javascript" src="${ctxStatic}/plugin/layui2.0/layui.js"></script>
    <link rel="stylesheet" href="${ctxStatic}/plugin/layui2.0/css/layui.css" media="all">
    <script type="text/javascript">

        function subForm() {
            var json=new Object();

            var fromData=new FormData();
            fromData.append("resourceCode","RECEIPT");
            fromData.append("receiptNo",$("#code").val());
            fromData.append("evidenceId",'${wr.evidenceId}');
            //提交数据
            $.ajax({
                url:"${ctx}/warehouse/warehouseReceipt/saveCode",
                type:"post",
                data:fromData,
                contentType: false, // 注意这里应设为false
                processData: false,
                beforeSend: function () {

                },
                complete: function () {

                },
                success:function(data){

                    if(data.message==0){

                        layer.alert('过机成功!', { icon: 1}, function (index) {
                            var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
                            parent.layer.close(index);//关闭页面
                            parent.$('#table').bootstrapTable('refresh');  //刷新table
                        });

                    }else if(data.message==1){
                        layer.alert(data.data, {
                            icon: 2,
                            title: "提示"
                        });

                    }
                },
                error:function(e){
                    layer.alert('保存失败!', {
                        icon: 2,
                        title: "提示"
                    });

                }
            });



        }
    </script>
</head>
<body>
<fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
    <legend>扫码过机</legend>
</fieldset>
<form class="layui-form" action="">
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">入库单:${wr.purchaseNo}</label>
        </div>

    </div>

    <div class="layui-form-item">
        <div class="layui-inline">
            <div class="layui-input-block">
                <div onclick="subForm()" class="layui-btn" >开启</div>
            </div>
            <div class="layui-input-block">
                <div onclick="subForm()" class="layui-btn" >关闭</div>
            </div>
        </div>
    </div>

    <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
        <legend>如手动添加ifid,请用英文逗号隔开</legend>
    </fieldset>

    <div id="purchaseOrder">
        <textarea id="code" name="code" placeholder="" class="layui-textarea"></textarea>

    </div>

</form>

</body>
</html>